import Vue from 'vue'
import Router from 'vue-router'
import Login from '@/pages/Login.vue'
import Index from '@/pages/Index.vue'
import User from '@/pages/admin/user/List'
import Role from '@/pages/admin/role/List'
import Menu from '@/pages/admin/menu/List'
import Home from '@/pages/Home.vue'
import Department from '@/pages/admin/department/List'
import Position from '@/pages/admin/position/List'
import SysLog from '@/pages/admin/syslog/list'
import Notice from '@/pages/admin/notice/List'
import Druid from '@/pages/admin/druid/List'
import App_IntegralGoods from '@/pages/app/integralGoods/List'
import App_IntegralGoodsType from '@/pages/app/integralGoods/type/List'
import App_User from '@/pages/app/user/List'
import App_Ranking from '@/pages/app/user/ranking/List'
import App_Water_List from '@/pages/app/integralWater/List'
import App_Water_Cash_Out from '@/pages/app/integralWater/cashOut/List'
import App_IntegralGoods_Records from '@/pages/app/integralGoods/records/List'
import App_Article from '@/pages/app/article/List'
import App_Comment from '@/pages/app/article/comment/List'
import App_Product from '@/pages/app/product/List'
import App_Product_Type from '@/pages/app/product/type/List'
import App_FeedBack from '@/pages/app/feedback/List'
import App_Message from '@/pages/app/message/List'
import App_Swiper from '@/pages/app/swiper/List'
import App_PartTimeJob from '@/pages/app/partTimeJob/List'
import App_Task from '@/pages/app/task/task/List'
import App_Packages from '@/pages/app/task/packages/List'
import Task from '@/pages/admin/quartz/List'

Vue.use(Router)

//获取原型对象上的push函数
const originalPush = Router.prototype.push
//修改原型对象中的push方法
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}
export default new Router({
  routes: [
    {
      path: '/login',
      name: '登陆页面',
      component: Login,
    },
    {
      path: '/',
      component: Home,
      redirect: "admin/index",
      children: [
        {
          path: 'admin/index',
          name: '首页',
          component: Index,
        },
        {
          path: 'admin/user/list',
          name: '用户列表',
          component: User,
        },
        {
          path: 'admin/role/list',
          name: '角色列表',
          component: Role,
        },
        {
          path: 'admin/menu/list',
          name: '菜单列表',
          component: Menu,
        },
        {
          path: 'admin/department/list',
          name: '部门列表',
          component: Department,
        },
        {
          path: 'admin/position/list',
          name: '岗位列表',
          component: Position,
        },
        {
          path: 'admin/syslog/list',
          name: '操作日志',
          component: SysLog
        },
        {
          path: 'admin/notice/list',
          name: '公告管理',
          component: Notice
        }, {
          path: 'admin/druid',
          name: '数据源监控',
          component: Druid
        },
        {
          path: 'admin/integralGoods/list',
          name: '积分商品列表',
          component: App_IntegralGoods
        },
        {
          path: 'admin/integralGoods/changeRecords/list',
          name: '兑换记录',
          component: App_IntegralGoods_Records
        },
        {
          path: 'admin/integralGoodsType/list',
          name: '积分商品类型',
          component: App_IntegralGoodsType
        }, {
          path: '/admin/app/customer/list',
          name: 'App用户',
          component: App_User
        }, {
          path: '/admin/app/ranking/list',
          name: '邀请排行榜',
          component: App_Ranking
        }, {
          path: '/admin/app/water/list',
          name: '积分流水',
          component: App_Water_List
        }, {
          path: '/admin/app/article/list',
          name: '文章列表',
          component: App_Article
        }, {
          path: '/admin/app/comment/list',
          name: '品论列表',
          component: App_Comment
        }, {
          path: '/admin/app/product/list',
          name: '闲置商品',
          component: App_Product
        }, {
          path: '/admin/app/product/type/list',
          name: '闲置商品类型',
          component: App_Product_Type
        }, {
          path: '/admin/app/water/cashOut/list',
          name: '积分提现',
          component: App_Water_Cash_Out
        }, {
          path: '/admin/app/feedBack/list',
          name: '用户反馈',
          component: App_FeedBack
        }, {
          path: '/admin/app/feedBack/list',
          name: '用户反馈',
          component: App_FeedBack
        }, {
          path: '/admin/app/message/list',
          name: '消息通知',
          component: App_Message
        }, {
          path: '/admin/app/swiper/list',
          name: '轮播图',
          component: App_Swiper

        }, {
          path: '/admin/app/partTimeJob/list',
          name: '兼职信息',
          component: App_PartTimeJob
        }
        , {
          path: '/admin/app/task/task/list',
          name: '跑腿列表',
          component: App_Task
        } , {
          path: '/admin/app/task/packages/list',
          name: '快递代拿',
          component: App_Packages
        },
        , {
          path: '/admin/sys/task',
          name: '定时任务',
          component: Task
        }
      ]
    },
  ]
})
